{strip}

{literal}
<script>

$(document).ready(function() { 
	var options = { 
        beforeSubmit:  showRequest,  // pre-submit callback 
        success:       showResponse  // post-submit callback 
    }; 
 
    // bind to the form's submit event 
    $('#users_add_form').submit(function() { 
    	//fakeSubmit.UpdateEditorFormValue();
        $(this).ajaxSubmit(options); 
 
        // !!! Important !!! 
        // always return false to prevent standard browser submit and page navigation 
        //checkForm();
        return false;
    }); 
});

// pre-submit callback 
function showRequest(formData, jqForm, options) { 
    var queryString = $.param(formData); 
    //return checkForm(); 
} 
 
// post-submit callback 
function showResponse(responseText, statusText)  { 
	scroll(0,0);
	//showPopup2(responseText, 'New Skinshop user', false);
	window.location.reload();
}
</script>
{/literal}

<div id="backoffice" >

<form id="users_add_form" method="POST" action="/users/save" onsubmit="">

<fieldset>
<legend>Fill the form</legend>

	
	<div>
		<label for="f1">Username</label>
		<input type="text" name="addForm[username]" value="{$user->getUsername()}"/>
		<input type="hidden" name="addForm[usersId]" value="{$user->getId()}" />
		<input type="hidden" name="addForm[appsId]" value="{$user->getAppsId()}" />
	</div>
	<div>
		<label for="f3">First name</label>
		<input id="f3" type="text" name="addForm[firstName]" value="{$user->getFirstName()}"  />
	</div>
	<div>
		<label for="f4">Last name</label>
		<input id="f4" type="text" name="addForm[lastName]" value="{$user->getLastName()}"  />
	</div>
	<div>
		<label for="f5">E-Mail</label>
		<input id="f5" type="text" name="addForm[email]" value="{$user->getEmail()}"  />
	</div>
	{if $loggedUser->getIsAdministrator()}
	<div>
		<label for="f6">Is Operator?</label>
		<input id="f6" type="checkbox" value="1" name="addForm[isOperator]" {if $user->getIsOperator() == 1}checked{/if}/>
		
	</div>
	{/if}
	<div>
		<label for="f4">User status</label>
		<select name="addForm[statusesId]" id="f4">
			{foreach from=$statuses item=st}
				<option value="{$st->getId()}" {if $user->getStatusesId() == $st->getId()}selected{/if}>{$st->getCatalogue()->getCatalogue()} -- {$st->getStatus()}</option>
			{/foreach}
		</select>
		
		<input type="hidden" name="addForm[sAddr][firstName]" value="{$user->getSaddrFirstName()}" />
		<input type="hidden" name="addForm[sAddr][lastName]" value="{$user->getSaddrLastName()}" />
		<input type="hidden" name="addForm[sAddr][email]" value="{$user->getSaddrEmail()}" />
		<input type="hidden" name="addForm[sAddr][street]" value="{$user->getSaddrStreet()}" />
		<input type="hidden" name="addForm[sAddr][buildingNo]" value="{$user->getSaddrBuildingNo()}" />
		<input type="hidden" name="addForm[sAddr][apartmentNo]" value="{$user->getSaddrApartmentNo()}" />
		<input type="hidden" name="addForm[sAddr][postcode]" value="{$user->getSaddrPostcode()}" />
		<input type="hidden" name="addForm[sAddr][city]" value="{$user->getSaddrCity()}" />
		<input type="hidden" name="addForm[sAddr][country]" value="{$user->getSaddrCountry()}" />
		<input type="hidden" name="addForm[bAddr][companyName]" value="{$user->getBaddrCompanyName()}" />
		<input type="hidden" name="addForm[bAddr][firstName]" value="{$user->getBaddrFirstName()}" />
		<input type="hidden" name="addForm[bAddr][lastName]" value="{$user->getBaddrLastName()}" />
		<input type="hidden" name="addForm[bAddr][email]" value="{$user->getBaddrEmail()}" />
		<input type="hidden" name="addForm[bAddr][street]" value="{$user->getBaddrStreet()}" />
		<input type="hidden" name="addForm[bAddr][buildingNo]" value="{$user->getBaddrBuildingNo()}" />
		<input type="hidden" name="addForm[bAddr][apartmentNo]" value="{$user->getBaddrApartmentNo()}" />
		<input type="hidden" name="addForm[bAddr][postcode]" value="{$user->getBaddrPostcode()}" />
		<input type="hidden" name="addForm[bAddr][city]" value="{$user->getBaddrCity()}" />
		<input type="hidden" name="addForm[bAddr][country]" value="{$user->getBaddrCountry()}" />
	</div>
	<div class="v_spacer"> </div>
	<div>
		<div class="left">
			<input type="button" value="Resign" class="submit" onclick="closePopup();"/>
		</div>
		<div class="right">
			<input type="submit" value="Submit" class="submit"/>
		</div>
	</div>

	
</fieldset>
</form>
</div>
{/strip}